package com.dingwen.treasure.model.entity.mybatisplus;

import com.baomidou.mybatisplus.annotation.*;
import com.dingwen.treasure.base.enums.LogicDeleteEnum;
import com.dingwen.treasure.base.enums.MsgState;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 消息表
 *
 * @author dingwen
 * @TableName treasure_message
 * @date 2022/08/09
 */
@TableName(value = "treasure_message")
@ApiModel(value = "TreasureMessage", description = "TreasureMessage")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@Builder
public class TreasureMessage implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = -6877466427853438302L;

    /**
     * 消息ID
     */
    @ApiModelProperty(value = " 消息ID")
    @TableId(value = "msg_id", type = IdType.ASSIGN_ID)
    private Long msgId;

    /**
     * 业务Id
     */
    @ApiModelProperty(value = " 消息ID")
    @TableField(value = "business_id")
    private Long businessId;

    /**
     * 消息状态：0已入库 1已投递 2已消费 3消费失败
     */
    @ApiModelProperty(value = " 消息状态")
    @TableField(value = "msg_state")
    private MsgState msgState;

    /**
     * 消息内容
     */
    @ApiModelProperty(value = " 消息内容")
    @TableField(value = "msg_body")
    private String msgBody;

    /**
     * 队列信息
     */
    @ApiModelProperty(value = " 队列信息")
    @TableField(value = "queue")
    private String queue;

    /**
     * 路由信息
     */
    @ApiModelProperty(value = " 路由信息")
    @TableField(value = "router")
    private String router;

    /**
     * 业务描述
     */
    @ApiModelProperty(value = " 业务描述")
    @TableField(value = "business_description")
    private String businessDescription;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = " 创建时间")
    @TableField(value = "create_time",fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    @ApiModelProperty(value = " 修改时间")
    @TableField(value = "update_time",fill = FieldFill.UPDATE)
    private LocalDateTime updateTime;

    /**
     * 逻辑删除：0已删除 1仍存在
     */
    @ApiModelProperty(value = " 逻辑删除")
    @TableField(value = "deleted")
    @TableLogic(value = "1",delval = "0")
    private LogicDeleteEnum deleted;

    /**
     * 乐观锁控制
     */
    @ApiModelProperty(value = " 乐观锁控制")
    @TableField(value = "version")
    @Version
    private Integer version;


    /**
     * 业务顺序
     */
    @ApiModelProperty(value = "业务顺序")
    @TableField(value = "business_order")
    private Integer businessOrder;

    /**
     * 交换机信息
     */
    @ApiModelProperty(value = "交换机信息")
    @TableField(value = "exchange")
    private String exchange;

}